package net.xo68.destiny.contract.enums.job;

/**
 * 任务状态枚举
 * @author wuxie
 * @version 2020-12-28
 */
public enum JobStateEnum {
    DISABLE((byte)0),
    RUNNING((byte)1),
    FINISH((byte)2);


    private final Byte code;

    JobStateEnum(Byte code) {
        this.code = code;
    }

    public Byte getCode() {
        return code;
    }

    public static JobStateEnum of(int code){
        for (JobStateEnum jobStateEnum: JobStateEnum.values()){
            if(code == jobStateEnum.getCode()){
                return jobStateEnum;
            }
        }
        return JobStateEnum.DISABLE;
    }
}
